package com.atguigu.jxc.service.impl;

import com.atguigu.jxc.dao.SupplierDao;
import com.atguigu.jxc.entity.Supplier;
import com.atguigu.jxc.service.SupplierService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class SupplierServiceImpl implements SupplierService {

    @Autowired
    private SupplierDao supplierDao;

    @Override
    public Page<Supplier> page(Integer page, Integer rows, String supplierName) {
        PageHelper.startPage(page,rows);
        Page pages = supplierDao.page(page,rows,supplierName);
        return pages;
    }

    @Override
    public void save(Supplier supplier) {
        supplierDao.save(supplier);
    }

    @Override
    public void update(Supplier supplier, Integer supplierId) {
        supplierDao.update(supplier,supplierId);
    }

    @Override
    public void delete(String ids) {
        String[] id = ids.split(",");
        supplierDao.delete(id);
    }
}
